import { cloneDeep } from '@/commons/utils';

const files = import.meta.globEager('./**/*.vue');
const components = {};

Object.keys(files).forEach(key => {
    const item = files[key].default;
    components[item.name] = {
        component: item,
        options: {}
    };
});

export const getComponentByName = (name, title) => {
    components[name].title = title;
    return cloneDeep(components[name]);
};
